package com.cskaoyan.controller.stat;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.vo.stat.StatVo;
import com.cskaoyan.service.state.StatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: market
 * @description: 用户、商品、订单统计业务
 * @author: zhong
 * @create: 2022-07-18 16:29
 **/
@RestController
@RequestMapping("admin/stat")
public class StatController {
    @Autowired
    StatService statService;

    /**
     * @param null:
     * @return 用户统计信息
     * @auther zhong
     * @description admin/stat/user 显示用户统计信息
     **/
    @GetMapping("user")
    public BaseRespVo statUser() {
        StatVo statVo = statService.statUserOp();
        return BaseRespVo.ok(statVo);
    }

    /**
     * @param null:
     * @return 订单统计信息
     * @auther zhong
     * @description admin/stat/order 显示订单统计信息
     **/
    @GetMapping("order")
    public BaseRespVo statOrder() {
        StatVo statVo = statService.statOrderOp();
        return BaseRespVo.ok(statVo);
    }

    /**
     * @param null:
     * @return 商品统计信息
     * @auther zhong
     * @description admin/stat/goods 显示商品的销售统计信息
     **/
    @GetMapping("goods")
    public BaseRespVo statGoods() {
        StatVo statVo = statService.statGoodsOp();
        return BaseRespVo.ok(statVo);
    }
}
